-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_ecs_service support deployment_minimum_healthy_percent for DAEMON strategy #6150
aws_ecs_service support deployment_minimum_healthy_percent for DAEMON strategy #6150
Conversation
Hi @bflad. Not sure if anyone has had a chance to look at this yet. Thanks |
I'm not trying to sound like a jerk or anything, but is this normal to have no response for a PR after 11 days? If this won't be accepted for whatever reason that's fine. I would just like to know. If it's not I'll most likely need to use Cloudformation for this. |
@mschurenko its likely to be reviewed and accepted (potentially with some changes) given my understanding of the situation. A bunch of HashiCorp and community members have been busy with preparation, travel, and attendance of HashiConf this week. |
Hey @bflad thanks a lot for the response. Sorry to be so pushy. I didn't realize HashiConf was next week. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial comments below. Please let us know if you have any questions or do not have time to implement the feedback.
aws/resource_aws_ecs_service.go
Outdated
@@ -106,12 +106,6 @@ func resourceAwsEcsService() *schema.Resource { | |||
Type: schema.TypeInt, | |||
Optional: true, | |||
Default: 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of leaving a Default: 100
here that only works for one of the scheduling strategies, should we instead remove Default: 100
and implement a DiffSuppressFunc
that covers suppressing the difference depending on the strategy? A similar update should likely occur for maximum as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove the Default
wouldn't that be backwards incompatible for those who are using a replica
strategy and didn't set deployment_minimum_healthy_percent
?
Similar for deployment_maximum_percent
, if we remove Default
won't that be a problem for backwards compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The port
attribute of the aws_elasticache_cluster
resource is an example of a place where we allow two defaults chosen by the API, but suppress the difference if it is left unconfigured in the Terraform configuration: https://github.com/terraform-providers/terraform-provider-aws/blob/4ef574a20eeecd860ef40bf4ca94849cee9af0ef/aws/resource_aws_elasticache_cluster.go#L146-L157
Its not pretty, but it works. 😄 We could also set Computed: true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. So when you say we allow two defaults chosen by the API
, do you mean by the AWS API?
aws/resource_aws_ecs_service.go
Outdated
@@ -354,7 +348,7 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error | |||
input.SchedulingStrategy = aws.String(schedulingStrategy) | |||
if schedulingStrategy == ecs.SchedulingStrategyDaemon { | |||
// unset these if DAEMON | |||
input.DeploymentConfiguration = nil | |||
input.DeploymentConfiguration.MaximumPercent = aws.Int64(100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to keep this logic here at all? Since the comment eludes to "unsetting" values due to DAEMON
we should either remove this line or add a comment why its being hardcoded to 100
…Minimum acceptance test
@bflad I made your recommended changes. I removed default values for I added another acceptance test so there is now I ran all the ecs acceptance tests and they have passed:
Also, I updated the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @mschurenko! 🚀
--- PASS: TestAccAWSEcsService_withARN (9.45s)
--- PASS: TestAccAWSEcsService_basicImport (11.82s)
--- PASS: TestAccAWSEcsService_withUnnormalizedPlacementStrategy (18.89s)
--- PASS: TestAccAWSEcsService_disappears (19.28s)
--- PASS: TestAccAWSEcsService_withRenamedCluster (20.57s)
--- PASS: TestAccAWSEcsService_withDeploymentValues (10.93s)
--- PASS: TestAccAWSEcsService_withFamilyAndRevision (41.15s)
--- PASS: TestAccAWSEcsService_withEcsClusterName (19.00s)
--- PASS: TestAccAWSEcsService_withLbChanges (38.46s)
--- PASS: TestAccAWSEcsService_withIamRole (119.67s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints (6.95s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints_emptyExpression (10.89s)
--- PASS: TestAccAWSEcsService_withPlacementStrategy (75.45s)
--- PASS: TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration (47.44s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategy (6.69s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum (6.61s)
--- PASS: TestAccAWSEcsService_withReplicaSchedulingStrategy (10.82s)
--- PASS: TestAccAWSEcsService_withServiceRegistries (16.71s)
--- PASS: TestAccAWSEcsService_withServiceRegistries_container (12.65s)
--- PASS: TestAccAWSEcsService_healthCheckGracePeriodSeconds (247.67s)
--- PASS: TestAccAWSEcsService_withAlb (231.25s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargate (262.40s)
This has been released in version 1.42.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This PR aims to fix #5236
To summarize, I would like to be able to set
deployment_minimum_healthy_percent
to 50 when using a scheduling strategy ofDAEMON
. Currently this is not possible as this value being set to nil. The result of this is thatdeployment_minimum_healthy_percent
is set to 0 (AWS default) which results in downtime for a deployment.This is my first PR to this project, so I might be missing something obvious, but there doesn't appear to be a way to conditionally set a default value in
github.com/hashicorp/terraform/helper/schema
https://github.com/terraform-providers/terraform-provider-aws/blob/master/vendor/github.com/hashicorp/terraform/helper/schema/schema.go#L37.Ideally the default value for
deployment_minimum_healthy_percent
would be 200 for REPLICA strategy and 0 for DAEMON, but I was unable to do that.As a result if one uses the DAEMON strategy but does not set a value for
deployment_minimum_healthy_percent
the default of 100 is used and you get this error:IMO this is better then the current behavior where one cannot set
deployment_minimum_healthy_percent
at all.Having said this, I'm hoping there's a better approach to doing this.
Changes proposed in this pull request:
aws_ecs_service
resource will usedeployment_minimum_healthy_percent
whenscheduling_strategy
is set toDAEMON
Output from acceptance testing: